const obj = {
  purchaserTable: '采购信息',
  purchaserAgreeTable: '履约信息',
  purchaserBidTable: '标的信息',
  purchaserBuyerTable: '买方信息',
  purchaserConTractTable: '合同信息',
  purchaserInvoiceTable: '发票付款',
  purchaserSellerTable: '卖方信息',
  purchaserSupplierTable: '报价供应商'
}
export function configForm () {
    return [
      {
        fieldName: "异常数据来源表",
        field: "dataProblemsInfo",
        value: "",
        type: "select",
        placeholder: "请选择异常数据来源表",
        optionList: Object.keys(obj).map(item => ({ value: item, label: obj[item] }))
      },
      {
        fieldName: "采购包或标段编号",
        field: "crsrmBiddingId",
        value: "",
        type: "input",
        placeholder: "请输入采购包或标段编号"
      },
      {
        fieldName: "采购包或标段名称",
        field: "crsrmBiddingName",
        value: "",
        type: "input",
        placeholder: "请输入采购包或标段名称"
      },
      {
        fieldName: "校验结果",
        field: "resultState",
        value: [],
        type: "select",
        optionList: this.crsrm_pur_result_state,
        isMul: true,
      },
/*      {
        fieldName: "框架协议编号",
        field: "crsrmFrameworkAgreementId",
        value: "",
        type: "input",
        placeholder: "请输入框架协议编号"
      },*/
      {
        fieldName: "投标人/供应商名称",
        field: "crsrmSupplierName",
        value: "",
        type: "input",
        placeholder: "请输入投标人/供应商名称"
      },
/*      {
        fieldName: "投标人/供应商代码",
        field: "crsrmSupplierSocialCredit",
        value: "",
        type: "input",
        placeholder: "请输入投标人/供应商代码"
      },*/
      {
        fieldName: "采购人名称",
        field: "crsrmPurchaserName",
        value: "",
        type: "input",
        placeholder: "请输入采购人名称"
      },
/*      {
        fieldName: "采购人代码",
        field: "crsrmPurchaserCode",
        value: "",
        type: "input",
        placeholder: "请输入采购人代码"
      },*/
      {
        fieldName: "合同名称",
        field: "crsrmContractName",
        value: "",
        type: "input",
        placeholder: "请输入合同名称"
      },
      {
        fieldName: "合同编号",
        field: "crsrmContractCode",
        value: "",
        type: "input",
        placeholder: "请输入合同编号"
      },
      {
        fieldName: "更新时间从",
        field: "start_date",
        aliasField: 'startDate',
        value: "",
        type: "date",
        placeholder: "请选择"
      },
      {
        fieldName: "更新时间至",
        field: "end_date",
        aliasField: 'endDate',
        value: "",
        type: "date",
        placeholder: "请选择"
      },
      {
        fieldName: "数据状态",
        field: "crsrmState",
        value: "",
        type: "select",
        placeholder: "请选择",
        optionList: this.crsrm_pur_state
      },
    ]
}

export function generateColumns() {
  return [
    {
      type: "selection",
      width: 60,
      align: "center",
      fixed: "left"
    },
    {
      title: '校验结果',
      align: "center",
      // width: 90,
      // resizable: true,
      key: 'resultState',
      render: (h, { row }) => {
        return this.resultHandle(h, row)
      }
    },
    {
      title: '异常数据来源表',
      width: 120,
      resizable: true,
      render: (h, { row }) => {
        return h('span', obj[row.dataProblemsInfo])
      }
    },
    {
      title: '数据状态',
      key: 'crsrmStateStr',
      render: (h, { row }) => {
        return this.dataStateHandle(h, row)
      }
    },
    {
      title: "采购包或标段编号",
      key: "crsrmBiddingId",
      minWidth: 160
    },
    {
      title: "采购包或标段名称",
      key: "crsrmBiddingName",
      minWidth: 160
    },
    {
      title: "采购人名称",
      key: "crsrmPurchaserName"
    },
    {
      title: "投标人/供应商名称",
      key: "crsrmSupplierName",
      minWidth: 150
    },
    {
      title: "合同名称",
      key: "crsrmContractName"
    },
    {
      title: "合同编号",
      key: "crsrmContractCode"
    },
    {
      title: "采购人所属的一级利润中心",
      key: "crsrmPurchaserSbuStr",
      minWidth: 190
    },
    {
      title: "更新时间（润智采）",
      key: "crsrmUpdateTime",
      minWidth: 160
    },
    {
      title: '操作',
      align: "left",
      fixed: "right",
      width: 60,
      render: (h, { row }) => {
        return h("RowTools", {
          props: {
            data: [
              {
                type: 'icon',
                icon: 'md-eye',
                text: '查看',
                handle: () => this.detailHandle(row)
              },
            ]
          }
        });
      }
    }
  ];
}
